﻿using UnityEngine;
using System.Collections;

public class BaseBulletScript : Poolable 
{
	public float speed = 12.0f;
	public float damage = 10.0f;

	public  void Shoot(Vector3 pos, Quaternion dir)
	{
		transform.position = pos;
		transform.rotation = dir;
	}
	
	// Update is called once per frame
	protected override void Update ()
	{
		base.Update ();
		transform.Translate (Vector3.forward * speed * Time.deltaTime);
	}

	public void OnTriggerEnter(Collider c)
	{
		Hittable h = c.GetComponent (typeof(Hittable)) as Hittable;
		if (h != null) 
		{
			h.Hit(damage);
			myPooler.AddToPool(gameObject, myStack);
		}
	}
}
